import request from '@u/request'

// 加入购物车 /shopping-cart/add
const addItemToCart = (params = {}) => (
  request.post('/shopping-cart/add', params)
)
// 获取购物车数据 /shopping-cart/info
const fetchCartInfo = (params = {}) => {
  return request.get('/shopping-cart/info', { params })
}
// 修改购物车商品 数量 /shopping-cart/modifyNumber
const modifyCartItemNum =  (params = {}) => (
  request.post('/shopping-cart/modifyNumber', params)
)
// 修改购物车商品选中状态
const modifyCartItemSelected =  (params = {}) => (
  request.post('/shopping-cart/select', params)
)
// 删除购物车中的商品 /shopping-cart/remove
const removeCartItem =  (params = {}) => (
  request.post('/shopping-cart/remove', params)
)
export {
  addItemToCart,
  fetchCartInfo,
  modifyCartItemNum,
  modifyCartItemSelected,
  removeCartItem
}